<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0053)http://msdn.microsoft.com/pt-br/library/79b3xss3.aspx -->
<html xmlns="http://www.w3.org/1999/xhtml"><head id="ctl00_Head1"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="canonical" href="./Static Classes and Static Class Members_files/Static Classes and Static Class Members.htm"><title>
	
  Static Classes and Static Class Members

</title>
<link href="./Static Classes and Static Class Members_files/LibraryView.css" rel="stylesheet" type="text/css">
<link href="./Static Classes and Static Class Members_files/Msdn_ImageSprite.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="./Static Classes and Static Class Members_files/printview.css" media="print" title="printonly">
<link rel="alternate" media="print" href="http://msdn.microsoft.com/pt-br/library/79b3xss3(d=printer).aspx">



<meta name="DCS.dcsuri" content="/pt-br/library/79b3xss3(d=lightweight,l=pt-br,v=VS.100).aspx">

<meta name="NormalizedUrl" content="http://msdn.microsoft.com/pt-br/library/79b3xss3(d=lightweight,l=pt-br,v=VS.100).aspx">

<meta name="VotingContextUrl" content="http://msdn.microsoft.com/pt-br/library/79b3xss3(l=pt-br,v=VS.100).aspx">

<meta name="MN" content="A581FDC1-5:07:15 AM">

<meta name="Search.ShortId" content="79b3xss3">

<meta name="Ms.Locale" content="pt-br">
<script type="text/javascript" async="" src="./Static Classes and Static Class Members_files/ms2.js"></script><script id="__isTpiViewExists"></script><style id="wrc-css" type="text/css">.wrcx {display:none} .r .wrcx, .osl .wrcx, .bc .wrcx, .fc .wrcx, #rhsline ol .wrcx {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/grey0-16.png") right no-repeat}
.wrc0 {display:none} .r .wrc0, .osl .wrc0, .bc .wrc0, .fc .wrc0, #rhsline ol .wrc0 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/grey0-16.png") right no-repeat}
.wrc11 {display:none} .r .wrc11, .osl .wrc11, .bc .wrc11, .fc .wrc11, #rhsline ol .wrc11 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/green1-16.png") right no-repeat}
.wrc12 {display:none} .r .wrc12, .osl .wrc12, .bc .wrc12, .fc .wrc12, #rhsline ol .wrc12 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/green2-16.png") right no-repeat}
.wrc13 {display:none} .r .wrc13, .osl .wrc13, .bc .wrc13, .fc .wrc13, #rhsline ol .wrc13 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/green3-16.png") right no-repeat}
.wrc21 {display:none} .r .wrc21, .osl .wrc21, .bc .wrc21, .fc .wrc21, #rhsline ol .wrc21 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/yellow1-16.png") right no-repeat}
.wrc22 {display:none} .r .wrc22, .osl .wrc22, .bc .wrc22, .fc .wrc22, #rhsline ol .wrc22 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/yellow2-16.png") right no-repeat}
.wrc23 {display:none} .r .wrc23, .osl .wrc23, .bc .wrc23, .fc .wrc23, #rhsline ol .wrc23 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/yellow3-16.png") right no-repeat}
.wrc31 {display:none} .r .wrc31, .osl .wrc31, .bc .wrc31, .fc .wrc31, #rhsline ol .wrc31 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/red1-16.png") right no-repeat}
.wrc32 {display:none} .r .wrc32, .osl .wrc32, .bc .wrc32, .fc .wrc32, #rhsline ol .wrc32 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/red2-16.png") right no-repeat}
.wrc33 {display:none} .r .wrc33, .osl .wrc33, .bc .wrc33, .fc .wrc33, #rhsline ol .wrc33 {display:inline; background: url("chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/red3-16.png") right no-repeat}
.wrc_icon{margin:0;padding:0;padding-left:15px !important;width:16px !important; height:16px !important;line-height:16px !important;}
#wrchoverdiv{padding-bottom:20px; position:absolute; width:180px; background:transparent url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/background-body.jpg) top left repeat-x; display:none; font-family: Segoe UI, Arial Unicode MS, Arial, Sans-Serif; font-size: 14px; z-index:9999999;}
#wrchoverdiv{cursor:default;}
#wrchoverdiv #wrccontainer{width:180px;}
#wrchoverdiv #wrcheader{width:140px; height:42px; background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/logo.jpg) bottom left no-repeat; text-align:right; line-height:42px; color:orange; margin:0 auto;}
#wrchoverdiv .wrchorizontal{width:180px; height:2px; background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/horizontal-line.jpg) bottom left no-repeat;}
#wrchoverdiv #wrccurrentvote{height:25px; line-height:25px; color:#FFF; text-align:center; text-transform:uppercase;}
#wrchoverdiv #wrcrating{margin:5px auto; width:69px; height:55px; background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/grey-0.png) bottom left no-repeat;}
#wrchoverdiv #wrcrating.wrcbx{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/grey-0.png);}
#wrchoverdiv #wrcrating.wrcb0{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/grey-0.png);}
#wrchoverdiv #wrcrating.wrcb11{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/green-1.png);}
#wrchoverdiv #wrcrating.wrcb12{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/green-2.png);}
#wrchoverdiv #wrcrating.wrcb13{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/green-3.png);}
#wrchoverdiv #wrcrating.wrcb21{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/yellow-1.png);}
#wrchoverdiv #wrcrating.wrcb22{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/yellow-2.png);}
#wrchoverdiv #wrcrating.wrcb23{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/yellow-3.png);}
#wrchoverdiv #wrcrating.wrcb31{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/red-1.png);}
#wrchoverdiv #wrcrating.wrcb32{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/red-2.png);}
#wrchoverdiv #wrcrating.wrcb33{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/red-3.png);}
#wrchoverdiv #wrcratingtext{margin:3px 5px; color:#FFF; text-align:center; padding:0; font-size:12px;}
#wrchoverdiv #wrcweighttext{margin:3px 5px; color:#FFF; text-align:center; padding:0; font-size:12px;}
#wrchoverdiv #wrcflags{width:150px; height:70px; margin:0 auto;}
#wrchoverdiv .wrcicon{width:30px; height:30px; float:left;}
#wrchoverdiv #wrcicon_shopping{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/shopping-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_shopping.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/shopping-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_social{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/social-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_social.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/social-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_news{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/news-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_news.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/news-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_it{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/it-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_it.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/it-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_corporate{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/corporate-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_corporate.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/corporate-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_pornography{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/pornography-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_pornography.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/pornography-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_violence{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/violence-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_violence.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/violence-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_gambling{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/gambling-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_gambling.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/gambling-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_drugs{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/drugs-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_drugs.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/drugs-small-selected.png) top left no-repeat;}
#wrchoverdiv #wrcicon_illegal{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/illegal-small-disable.png) top left no-repeat;}
#wrchoverdiv #wrcicon_illegal.selected{background:url(chrome-extension://icmlaeflemplmjndnaapfdbbnpncnbda/skin/images/icons/illegal-small-selected.png) top left no-repeat;}
</style><link rel="stylesheet" type="text/css" href="chrome-extension://mdebcffgnijbblbinknkbefciofebcda/css/about.css"></head>
<body>

   <script type="text/javascript" src="./Static Classes and Static Class Members_files/Library.js"></script>
    <div class="MetricsContainer">
    
    <div class="WebtrendsContainer">
      
<!-- Webtrends Start -->
<script type="text/javascript" language="javascript">
//<![CDATA[
  var literalNormalizedUrl = '/pt-br/library/79b3xss3(d=lightweight,l=pt-br,v=VS.100).aspx';
  var wt_nvr_ru = 'WT_NVR_RU';
  var wt_fpcdom = '.microsoft.com';
  var wt_domlist = 'msdn.microsoft.com';
  var wt_pathlist = '';
  var wt_paramlist = 'DCSext.mtps_devcenter';
  var wt_siteid = 'MSDN';
  var gDomain = 'm.webtrends.com';
  var gDcsId = 'dcsmgru7m99k7mqmgrhudo0k8_8c6m';
  var gFpc = 'WT_FPC';
  if (document.cookie.indexOf(gFpc + "=") == -1) {
    document.write("<scr" + "ipt type='text/javascript' src='" + "http" + (window.location.protocol.indexOf('https:') == 0 ? 's' : '') + "://" + gDomain + "/" + gDcsId + "/wtid.js" + "'><\\/scr" + "ipt>");
  }
  var detectedLocale = 'pt-br';
  var wtsp = 'msdnlib_devtools_lang';
  var gTrackEvents = '0';
/*]]>*/
</script>
<noscript>&lt;div&gt;&lt;img alt="DCSIMG" id="Img1" width="1" height="1" src="http://m.webtrends.com/dcsmgru7m99k7mqmgrhudo0k8_8c6m/njs.gif?dcsuri=/nojavascript&amp;amp;WT.js=No"/&gt;&lt;/div&gt;</noscript>
<script type="text/javascript" language="javascript" src="./Static Classes and Static Class Members_files/webtrendsscript.js"></script>
<!-- Webtrends End -->
    </div>
    
    <div class="OmnitureContainer">
      

<!--Omniture scripts and dependencies -->

<script type="text/javascript">
  var omni_guid = 'a26801cd-ca72-4ace-81ca-912e51b15fc5'; 
</script>

<script type="text/javascript" language="javascript" src="./Static Classes and Static Class Members_files/omni_rsid_MSDN.js"></script>

<noscript>
    &lt;a href="http://www.omniture.com" title="Web Analytics"&gt;
        &lt;img src="//msstonojsmsdn.112.2o7.net/b/ss/msstonojsmsdn/1/H.20.2--NS/0" height="1"
            width="1" border="0" alt="" /&gt;&lt;/a&gt;
</noscript>


    </div>
    
  
</div>
  <script language="javascript" type="text/javascript" src="./Static Classes and Static Class Members_files/broker.js"></script>


  <div class="header">
    
<link href="./Static Classes and Static Class Members_files/MSDN.Header.css" rel="stylesheet" type="text/css">
<table border="0" cellpadding="0" cellspacing="0" class="headerBar cl_lightweight_topnav_slice">
		<tbody><tr>
			<td class="leftSection cl_lightweight_header_leftSection_wave leftSectionImageClusterOverride">
        <div class="tabContainer">
          <a href="http://msdn.microsoft.com/pt-br/default.aspx" title="HomePage" class=" headerTab">HomePage</a>
          <a href="http://msdn.microsoft.com/pt-br/library/default.aspx" title="Biblioteca" class="headerTabSelected cl_lightweight_selected_tab_repeatX ">Biblioteca</a>
          <a href="http://msdn.microsoft.com/pt-br/bb188199.aspx" title="Aprender" class=" headerTab">Aprender</a>
          <a href="http://msdn.microsoft.com/pt-br/aa570309.aspx" title="Downloads" class=" headerTab">Downloads</a>
          <a href="http://msdn.microsoft.com/pt-br/hh361695.aspx" title="Suporte" class=" headerTab">Suporte</a>
          <a href="http://msdn.microsoft.com/pt-br/aa497440.aspx" title="Comunidade" class=" headerTab">Comunidade</a>
          
        </div>
      </td>
			<td class="rightSection cl_lightweight_header_rightSection_wave rightSectionImageClusterOverride">
        <div class="tabContainer">
            
            <a href="https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1325768835&rver=6.0.5276.0&wp=MCLBI&wlcxt=msdn%24msdn%24msdn&wreply=http%3a%2f%2fmsdn.microsoft.com%2fpt-br%2flibrary%2f79b3xss3.aspx&lc=1046&id=254354&mkt=pt-BR" title=" Entrar  " rel="nofollow"> Entrar   </a>
            <span class="pipe">|</span>
            <a href="http://msdn.microsoft.com/pt-br/library/preferences/locale/?returnurl=%252fpt-br%252flibrary%252f79b3xss3.aspx" title="Brasil - Português" rel="nofollow">Brasil - Português </a>
            <span class="pipe">|</span>
            <a class="dispinline clip15x15" href="http://msdn.microsoft.com/pt-br/library/preferences/experience/?returnurl=%252fpt-br%252flibrary%252f79b3xss3.aspx" title="Preferências" rel="nofollow"><img class="head_gear" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" alt=""></a>
            <span class="pipe">|</span>
            <a id="exportPrintLink" class="dispinline clip30x15 moveToDown" href="http://msdn.microsoft.com/pt-br/library/79b3xss3(d=printer).aspx" title="Imprimir/exportar"><img class="head_print_noarrow" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" alt=""></a>
            
            <div id="exportPrintLinkArrowDiv" class="exportPrintLinkArrow">
            <a id="exportPrintLinkArrow" class="dispinline clip30x15 moveToDown" href="javascript:void(0);" title="Imprimir/exportar"><img class="head_print_arrow" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" alt=""></a>
            </div>
            
        </div>
			</td>
	</tr>
</tbody></table>

  </div>
  <div class="contentPlaceHolder">
    
    
  <div class="navigation" id="Navigation" style="width:280px;padding-bottom:96px;">
    <div class="searchcontainer">
      
<form id="SearchForm" action="http://social.msdn.microsoft.com/search/pt-br" method="get" style="margin: 0;
padding: 0;" onsubmit="return checkSearchBox()">
<div class="searchBoxContainer" style="">
  <table class="searchBox" cellpadding="0" cellspacing="0" border="0">
    <tbody><tr>
      <td class="searchTextBoxTd">
        <input id="SearchInput" type="text" maxlength="200" class="searchTextBox" name="query">
        
      </td>
      <td class="searchButtonTd">
          <input type="image" src="./Static Classes and Static Class Members_files/search_icon.gif" style="position: relative;" title="Pesquisar ">
      </td>
    </tr>
  </tbody></table>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
    if (!MTPS) var MTPS = {};
    if (!MTPS.Watermarks) MTPS.Watermarks = {};
    MTPS.Watermarks.SearchInput = {
        "control": "SearchInput",
        "defaultValue": "Procurar no MSDN com o Bing",
        "defaultCSS": "searchTextBox",
        "focusCSS": "searchTextBoxTrue"
    };
    function checkSearchBox() {
        if (document.getElementById("SearchInput").value == MTPS.Watermarks.SearchInput.defaultValue) {
            document.getElementById("SearchInput").value = "";
        }
    }
 //]]>
</script>


    </div>
    <div class="navcontainer">
      
<div class="nav">
    
    <div id="tocnav">
        
        <div class="toclevel0 ancestry">
            
            <div class="clip5x9 nav_root">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_bullet" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ms123401.aspx" id="ms310241_MSDN.10_pt-br" title="Biblioteca MSDN">Biblioteca MSDN</a>
            </div>
            
            <div class="clip5x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_arrow" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/aa187916.aspx" id="aa187916_MSDN.10_pt-br" title="Ferramentas de desenvolvimento e linguagens">Ferramentas de desenvolvimento e linguagens</a>
            </div>
            
            <div class="clip5x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_arrow" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/dd831853.aspx" id="aa187917_MSDN.10_pt-br" title="Visual Studio 2010">Visual Studio 2010</a>
            </div>
            
            <div class="clip5x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_arrow" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/52f3sw5c.aspx" id="dd429925_VS.100_pt-br" title="Visual Studio">Visual Studio</a>
            </div>
            
            <div class="clip5x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_arrow" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ee822860.aspx" id="dd548131_VS.100_pt-br" title="Idiomas de Visual Studio">Idiomas de Visual Studio</a>
            </div>
            
            <div class="clip5x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_arrow" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/dd642420.aspx" id="ee839491_VS.100_pt-br" title="Visual Basic e C# Visual">Visual Basic e C# Visual</a>
            </div>
            
            <div class="clip5x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_arrow" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/kx37x362.aspx" id="ms297410_VS.100_pt-br" title="Visual C#">Visual C#</a>
            </div>
            
            <div class="clip5x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_arrow" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/67ef8sbd.aspx" id="ms297449_VS.100_pt-br" title="C# Programming Guide">C# Programming Guide</a>
            </div>
            
            <div class="clip13x9 nav_arrows">
                <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
            </div>
            
            <div class="nav_div_currentroot">
                <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ms173109.aspx" id="ms297452_VS.100_pt-br" title="Classes e estruturas (guia de programação de C#)">Classes e estruturas (guia de programação de C#)</a>
            </div>
            
        </div>
        
        <div class="toclevel1 children" style="border-bottom: 1px solid #bbbbbb;">
            
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/x9afc042.aspx" title="Classes (C# Programming Guide)">Classes (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/ms173110.aspx" title="Objects (C# Programming Guide)">Objects (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/saxz13w4.aspx" id="ff361513_VS.100_pt-br" title="Structs (C# Programming Guide)">Structs (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/ms173149.aspx" title="Inheritance (C# Programming Guide)">Inheritance (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ms173152.aspx" id="ff361514_VS.100_pt-br" title="Polymorphism (C# Programming Guide)">Polymorphism (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ms173150.aspx" id="ff361515_VS.100_pt-br" title="Abstract and Sealed Classes and Class Members (C# Programming Guide)">Abstract and Sealed Classes and Class Members (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div class="toclevel1 current">
                    <a data-tochassubtree="false" href="./Static Classes and Static Class Members_files/Static Classes and Static Class Members.htm" title="Static Classes and Static Class Members (C# Programming Guide)">Static Classes and Static Class Members (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/ms173113.aspx" title="Members (C# Programming Guide)">Members (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/ms173121.aspx" title="Access Modifiers (C# Programming Guide)">Access Modifiers (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/ms173118.aspx" title="Campos (guia de programação de C#)">Campos (guia de programação de C#)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ms173119.aspx" id="ff361516_VS.100_pt-br" title="Constantes (guia de programação de C#)">Constantes (guia de programação de C#)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/x9fsa0sw.aspx" id="ff361517_VS.100_pt-br" title="Properties (C# Programming Guide)">Properties (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ms173114.aspx" id="ff361518_VS.100_pt-br" title="Methods (C# Programming Guide)">Methods (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/ace5hbzh.aspx" id="ff361523_VS.100_pt-br" title="Constructors (C# Programming Guide)">Constructors (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/66x5fx1b.aspx" title="Destructors (C# Programming Guide)">Destructors (C# Programming Guide)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/bb384062.aspx" id="ff361524_VS.100_pt-br" title="Objeto e coleção inicializadores (guia de programação de C#)">Objeto e coleção inicializadores (guia de programação de C#)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/ms173120.aspx" title="Tipos aninhados (guia de programação de C#)">Tipos aninhados (guia de programação de C#)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="false" href="http://msdn.microsoft.com/pt-br/library/wa80x488.aspx" title="Parcial Classes e métodos (guia de programação de C#)">Parcial Classes e métodos (guia de programação de C#)</a>
                </div>
                
                <div class="clip13x9 nav_dots_current">
                    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_nav_dots" alt="">
                </div>
                
                <div>
                    <a data-tochassubtree="true" href="http://msdn.microsoft.com/pt-br/library/bb397696.aspx" id="ff361525_VS.100_pt-br" title="Tipos anônimos (guia de programação de C#)">Tipos anônimos (guia de programação de C#)</a>
                </div>
                
        </div>
        
    </div>
    <img src="./Static Classes and Static Class Members_files/clear.gif" alt="Separator" class="communityContentNavigationSeparator cl_lt_cc_line_top">
    
    <div class="communityContentNavigation">
        <div class="communityContentNavigationHeader">
            Conteúdo da Comunidade</div>
        
        <div class="communityContentNavigationPost">
            <div class="communityContentNavigationAvatarContainer">
                <a class="communityContentNavigationLinkAvatar" href="http://msdn.microsoft.com/pt-br/library/79b3xss3.aspx#CommunityContent" title="User"><img alt="Avatar" class="cl_default_avatar" src="./Static Classes and Static Class Members_files/clear.gif"></a>
            </div>
            
            <div class="communityContentNavigationLinkAbstractAdvertisement">
                <ul>
                    <li>
                        Adicione exemplos de código e dicas para aprimorar este tópico.</li>
                </ul>
            </div>
            
        </div>
        
        <div class="communityContentNavigationMoreLink">
            <a href="http://msdn.microsoft.com/pt-br/library/79b3xss3.aspx#CommunityContent" title="Mais...">Mais...</a></div>
    </div>
    
</div>

<script type="text/javascript"> 
  //<![CDATA[
  if (!MTPS) var MTPS = {};
  MTPS.TopicNodes= {
  
            "_last": ''
    };
  //]]>
</script>

    </div>
    
  </div>
  <div id="tocResizeContainer" style="visibility: visible; ">
  <a href="javascript:void(0)" class="tocResize" id="TocResize" style="left:280px">
    <img id="ResizeImageIncrease" class="cl_nav_resize_open" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" title="Expandir" alt="Expandir">
      <img id="ResizeImageReset" class="cl_nav_resize_close" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" style="display:none" title="Minimizar" alt="Minimizar">
  </a>
  </div>
  <div class="content">
    <img class="TOC_Fade_Top cl_lw_toc_fade_top" src="./Static Classes and Static Class Members_files/clear.gif" alt="">
    
<div id="MTPSTranslator" class="MTPSTranslator">
  <table class="MTPSTranslatorTable" style="width:100%">
    <tbody><tr>
      <td class="TranslationAlertBox"><div>Este é um conteúdo traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. <a href="http://msdn.microsoft.com/pt-br/dd362340.aspx">Mais informações.</a></div></td>
      
      <td class="TranslationViewSwitcher">
        <div>
          <input title="Mostrar texto traduzido" value="0" name="TrnaslatorView" type="radio" class="translatechoice" checked="checked"><span>Tradução</span>
        </div>
        <div>
          <input title="Mostrar texto em inglês " value="1" name="TrnaslatorView" type="radio" class="translatechoice"><span>Original</span>
        </div>
      </td>
      
    </tr>
  </tbody></table>
</div>

<script src="./Static Classes and Static Class Members_files/jquery-1.6.min.js" type="text/javascript"></script>

<script type="text/javascript">
  //<![CDATA[
  if (!MTPS) var MTPS = {};
  MTPS.MTSentences = {
        "src1" : 'A \u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDo1NTA5ZTIxNS0yMTgzLTRkYTMtYmFiNC02YjdlNjA3YTRmZGYiIHJ1bmF0PSJzZXJ2ZXIiIHhtbG5zOm10cHM9Imh0dHA6Ly9tc2RuMi5taWNyb3NvZnQuY29tL210cHMiPnN0YXRpYzwvbXRwczpJbnN0cnVtZW50ZWRMaW5rPg==\"\u003e\u003cspan\u003estatic\u003c/span\u003e\u003c/span\u003e class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated.',
          "src2" : 'In other words, you cannot use the \u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDplNDEzNjUxNi1mMDU4LTQ1YTgtODRlNS1kYTAwYTVjZjliNmEiIHJ1bmF0PSJzZXJ2ZXIiIHhtbG5zOm10cHM9Imh0dHA6Ly9tc2RuMi5taWNyb3NvZnQuY29tL210cHMiPm5ldzwvbXRwczpJbnN0cnVtZW50ZWRMaW5rPg==\"\u003e\u003cspan\u003enew\u003c/span\u003e\u003c/span\u003e keyword to create a variable of the class type.',
          "src3" : 'Because there is no instance variable, you access the members of a static class by using the class name itself.',
          "src4" : 'For example, if you have a static class that is named \u003cspan class=\"code\"\u003eUtilityClass\u003c/span\u003e that has a public method named \u003cspan class=\"code\"\u003eMethodA\u003c/span\u003e, you call the method as shown in the following example:',
          "src5" : 'A static class can be used as a convenient container for sets of methods that just operate on input parameters and do not have to get or set any internal instance fields.',
          "src6" : 'For example, in the .NET Framework Class Library, the static \u003cspan\u003e\u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDpUJTNhU3lzdGVtLk1hdGgiIHJ1bmF0PSJzZXJ2ZXIiIHhtbG5zOm10cHM9Imh0dHA6Ly9tc2RuMi5taWNyb3NvZnQuY29tL210cHMiPlN5c3RlbTxtdHBzOkxhbmd1YWdlU3BlY2lmaWNUZXh0IHJ1bmF0PSJzZXJ2ZXIiPjx2YXJpYXRpb24gZGV2TGFuZz0iY3MiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIj4uPC92YXJpYXRpb24+PHZhcmlhdGlvbiBkZXZMYW5nPSJ2YiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPi48L3ZhcmlhdGlvbj48dmFyaWF0aW9uIGRldkxhbmc9ImNwcCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPjo6PC92YXJpYXRpb24+PHZhcmlhdGlvbiBkZXZMYW5nPSJudSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPi48L3ZhcmlhdGlvbj48L210cHM6TGFuZ3VhZ2VTcGVjaWZpY1RleHQ+TWF0aDwvbXRwczpJbnN0cnVtZW50ZWRMaW5rPg==\"\u003e\u003cspan\u003eSystem\u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6TGFuZ3VhZ2VTcGVjaWZpY1RleHQgcnVuYXQ9InNlcnZlciIgeG1sbnM6bXRwcz0iaHR0cDovL21zZG4yLm1pY3Jvc29mdC5jb20vbXRwcyI+PHZhcmlhdGlvbiBkZXZMYW5nPSJjcyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPi48L3ZhcmlhdGlvbj48dmFyaWF0aW9uIGRldkxhbmc9InZiIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCI+LjwvdmFyaWF0aW9uPjx2YXJpYXRpb24gZGV2TGFuZz0iY3BwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCI+Ojo8L3ZhcmlhdGlvbj48dmFyaWF0aW9uIGRldkxhbmc9Im51IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCI+LjwvdmFyaWF0aW9uPjwvbXRwczpMYW5ndWFnZVNwZWNpZmljVGV4dD4=\" xmlns=\"\"\u003e\u003cspan\u003e.\u003c/span\u003e\u003c/span\u003eMath\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e class contains methods that perform mathematical operations, without any requirement to store or retrieve data that is unique to a particular instance of the \u003cspan\u003e\u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDpUJTNhU3lzdGVtLk1hdGgiIHJ1bmF0PSJzZXJ2ZXIiIHhtbG5zOm10cHM9Imh0dHA6Ly9tc2RuMi5taWNyb3NvZnQuY29tL210cHMiPk1hdGg8L210cHM6SW5zdHJ1bWVudGVkTGluaz4=\"\u003e\u003cspan\u003eMath\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e class.',
          "src7" : 'That is, you apply the members of the class by specifying the class name and the method name, as shown in the following example.',
          "src8" : 'As is the case with all class types, the type information for a static class is loaded by the .NET Framework common language runtime (CLR) when the program that references the class is loaded. The program cannot specify exactly when the class is loaded.',
          "src9" : 'However, it is guaranteed to be loaded and to have its fields initialized and its static constructor called before the class is referenced for the first time in your program.',
          "src10" : 'A static constructor is only called one time, and a static class remains in memory for the lifetime of the application domain in which your program resides.',
          "src11" : 'To create a non-static class that allows only one instance of itself to be created, see \u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iaHR0cDovL2dvLm1pY3Jvc29mdC5jb20vZndsaW5rLz9MaW5rSUQ9MTAwNTY3IiBydW5hdD0ic2VydmVyIiB4bWxuczptdHBzPSJodHRwOi8vbXNkbjIubWljcm9zb2Z0LmNvbS9tdHBzIj5JbXBsZW1lbnRpbmcgU2luZ2xldG9uIGluIEMjPC9tdHBzOkluc3RydW1lbnRlZExpbms+\"\u003e\u003cspan\u003eImplementing Singleton in C#\u003c/span\u003e\u003c/span\u003e.',
          "src12" : 'The following list provides the main features of a static class:',
          "src13" : 'Contains only static members.',
          "src14" : 'Cannot be instantiated.',
          "src15" : 'Is sealed.',
          "src16" : 'Cannot contain \u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDoyNDY2Mzc3OS1jMWU1LTRhZjQtYTk0Mi1jYTU1NGU0YzU0MmQiIHJ1bmF0PSJzZXJ2ZXIiIHhtbG5zOm10cHM9Imh0dHA6Ly9tc2RuMi5taWNyb3NvZnQuY29tL210cHMiPkluc3RhbmNlIENvbnN0cnVjdG9yczwvbXRwczpJbnN0cnVtZW50ZWRMaW5rPg==\"\u003e\u003cspan\u003eInstance Constructors\u003c/span\u003e\u003c/span\u003e.',
          "src17" : 'Creating a static class is therefore basically the same as creating a class that contains only static members and a private constructor.',
          "src18" : 'A private constructor prevents the class from being instantiated.',
          "src19" : 'The advantage of using a static class is that the compiler can check to make sure that no instance members are accidentally added.',
          "src20" : 'The compiler will guarantee that instances of this class cannot be created.',
          "src21" : 'Static classes are sealed and therefore cannot be inherited.',
          "src22" : 'They cannot inherit from any class except \u003cspan\u003e\u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDpUJTNhU3lzdGVtLk9iamVjdCIgcnVuYXQ9InNlcnZlciIgeG1sbnM6bXRwcz0iaHR0cDovL21zZG4yLm1pY3Jvc29mdC5jb20vbXRwcyI+T2JqZWN0PC9tdHBzOkluc3RydW1lbnRlZExpbms+\"\u003e\u003cspan\u003eObject\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e.',
          "src23" : 'Static classes cannot contain an instance constructor; however, they can contain a static constructor.',
          "src24" : 'Non-static classes should also define a static constructor if the class contains static members that require non-trivial initialization.',
          "src25" : 'For more information, see \u003cspan\u003e\u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDoxNTFlYzk1ZS0zYzRkLTRlZDctODg1ZC05NWI3YTNiZTJlN2QiIHJ1bmF0PSJzZXJ2ZXIiIHhtbG5zOm10cHM9Imh0dHA6Ly9tc2RuMi5taWNyb3NvZnQuY29tL210cHMiPlN0YXRpYyBDb25zdHJ1Y3RvcnMgKEMjIFByb2dyYW1taW5nIEd1aWRlKTwvbXRwczpJbnN0cnVtZW50ZWRMaW5rPg==\"\u003e\u003cspan\u003eStatic Constructors (C# Programming Guide)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e.',
          "src26" : 'Here is an example of a static class that contains two methods that convert temperature from Celsius to Fahrenheit and from Fahrenheit to Celsius:',
          "src27" : 'A non-static class can contain static methods, fields, properties, or events.',
          "src28" : 'The static member is callable on a class even when no instance of the class has been created.',
          "src29" : 'The static member is always accessed by the class name, not the instance name.',
          "src30" : 'Only one copy of a static member exists, regardless of how many instances of the class are created.',
          "src31" : 'Static methods and properties cannot access non-static fields and events in their containing type, and they cannot access an instance variable of any object unless it is explicitly passed in a method parameter.',
          "src32" : 'It is more typical to declare a non-static class with some static members, than to declare an entire class as static.',
          "src33" : 'Two common uses of static fields are to keep a count of the number of objects that have been instantiated, or to store a value that must be shared among all instances.',
          "src34" : 'Static methods can be overloaded but not overridden, because they belong to the class, and not to any instance of the class.',
          "src35" : 'Although a field cannot be declared as \u003cspan class=\"code\"\u003estatic const\u003c/span\u003e, a \u003cspan class=\"mtpsTagOuterHtml\" outerHtml=\"PG10cHM6SW5zdHJ1bWVudGVkTGluayBOYXZpZ2F0ZVVybD0iQXNzZXRJZDo3OWViNDQ3Yy0xMTdiLTQ0MTgtOTMzZi05N2M1MGFhNDcyZGIiIHJ1bmF0PSJzZXJ2ZXIiIHhtbG5zOm10cHM9Imh0dHA6Ly9tc2RuMi5taWNyb3NvZnQuY29tL210cHMiPmNvbnN0PC9tdHBzOkluc3RydW1lbnRlZExpbms+\"\u003e\u003cspan\u003econst\u003c/span\u003e\u003c/span\u003e field is essentially static in its behavior.',
          "src36" : 'It belongs to the type, not to instances of the type.',
          "src37" : 'Therefore, const fields can be accessed by using the same \u003cspan class=\"code\"\u003eClassName.MemberName\u003c/span\u003e notation that is used for static fields.',
          "src38" : 'No object instance is required.',
          "src39" : 'C# does not support static local variables (variables that are declared in method scope). ',
          "src40" : 'You declare static class members by using the \u003cspan\u003e\u003cspan class=\"input\"\u003estatic\u003c/span\u003e\u003c/span\u003e keyword before the return type of the member, as shown in the following example:',
          "src41" : 'Static members are initialized before the static member is accessed for the first time and before the static constructor, if there is one, is called.',
          "src42" : 'To access a static class member, use the name of the class instead of a variable name to specify the location of the member, as shown in the following example:',
          "src43" : 'If your class contains static fields, provide a static constructor that initializes them when the class is loaded.',
          "src44" : 'A call to a static method generates a call instruction in Microsoft intermediate language (MSIL), whereas a call to an instance method generates a \u003cspan\u003e\u003cspan class=\"input\"\u003ecallvirt\u003c/span\u003e\u003c/span\u003e instruction, which also checks for a null object references.',
          "src45" : 'However, most of the time the performance difference between the two is not significant.',
      
      // IE script workaround fix: there will be an extra comma in end of array generated
      "_last": ''
    };
  //]]>
</script>

 <script src="./Static Classes and Static Class Members_files/Translator.js" type="text/javascript"></script>
 <script src="./Static Classes and Static Class Members_files/jquery.popup.js" type="text/javascript"></script>
 <link rel="stylesheet" href="./Static Classes and Static Class Members_files/jquery.popup.css" type="text/css"> 

<link href="./Static Classes and Static Class Members_files/Msdn_ImageSprite.css" rel="stylesheet" type="text/css">
<div class="clip117x31 logo">
  <a href="http://msdn.microsoft.com/pt-br/default.aspx">
    <img src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="msdn_body_logo" alt="MSDN" title="MSDN">
  </a>
</div>

    <div class="topicContainer" style="">
      <!--starting processing-->
<div class="topic" xmlns="http://www.w3.org/1999/xhtml">
  <h1 class="title">Static Classes and Static Class Members (C# Programming Guide)<!----></h1>
  <div class="lw_vs">
    <div id="curversion">
      <strong>
            Visual Studio 2010</strong>
    </div>
    <div id="versionclick" style="visibility: visible; ">
      <div id="vsseperator" class="cl_lw_vs_seperator"></div>
      <div id="versionclick_c1"></div>
      <div id="versionclick_c2">
        <div class="">
          <a id="vsLink" href="javascript:;">
                    Outras versões
                </a>
        </div>
        <div class="cl_vs_arrow clip10x10">
          <img class="cl_lw_vs_arrow" id="vsArrow" alt="" src="./Static Classes and Static Class Members_files/MSDN_ImageSprite.png">
        </div>
      </div>
      <div id="versionclick_c3"></div>
    </div>
    <ul id="vsPanel">
      <li>
        <a href="http://msdn.microsoft.com/pt-br/library/79b3xss3(v=VS.90).aspx" title="">Visual Studio 2008</a>
      </li>
      <li>
        <a href="http://msdn.microsoft.com/pt-br/library/79b3xss3(v=VS.80).aspx" title="">Visual Studio 2005</a>
      </li>
    </ul>
  </div>
  <div style="clear:both;"></div>
  <!--Content type: Devdiv1. Transform: orcas2mtps.xslt.-->
  <div id="mainSection">
    <div id="mainBody">
      <p>
        <!---->
      </p> <div class="introduction"><p><span id="xn1_8dd7ef414f7b9ff0f0aa86fb12047797" class="sentence">Uma classe estática <a href="http://msdn.microsoft.com/pt-br/library/98f28cdx.aspx">http://msdn.microsoft.com/pt-br/library/98f28cdx.aspx</a> é basicamente a mesma que uma classe não-estática, mas há uma diferença: uma classe estática não pode ser instanciada.</span>  <span id="xn2_b3c85102288466fa7861472192a81ff5" class="sentence">Em outras palavras, você não pode usar a <a href="http://msdn.microsoft.com/pt-br/library/51y09td4.aspx">http://msdn.microsoft.com/pt-br/library/51y09td4.aspx</a> Palavra-chave new para criar uma variável do tipo da classe.</span>  <span id="xn3_43950e73949a8441538c33c0519f3ea5" class="sentence">Como não há nenhuma variável de instância, você acessa os membros de uma classe estática usando o nome de classe propriamente dito.</span>  <span id="xn4_469bdc351cbbd2304e1d792349e32afd" class="sentence">Por exemplo, se você tiver uma classe estática denominada UtilityClass contendo um método público chamado MethodA, você chama o método conforme o exemplo seguinte:</span>  </p>

<div class="codeSnippetContainer" xmlns="http://www.w3.org/1999/xhtml">
  <script type="text/javascript" src="./Static Classes and Static Class Members_files/CodeSnippet.js"></script>
  <link href="./Static Classes and Static Class Members_files/CodeSnippet.css" rel="stylesheet" type="text/css">
    <div class="codeSnippetContainerTabs">
        <div class="codeSnippetContainerTab codeSnippetContainerTabSingle" dir="ltr"><a>C#</a></div>
    </div>
    <div class="codeSnippetContainerCodeContainer">
        <div class="codeSnippetToolBar">
            <div class="codeSnippetToolBarText">
                <a name="CodeSnippetCopyLink" title="Copiar para a área de transferência." href="javascript:CodeSnippet_CopyCode('CodeSnippetContainerCode_62087488-fa0b-4cd8-a77f-0e29e628cde9');">Copiar</a>
            </div>
        </div>
        <div id="CodeSnippetContainerCode_62087488-fa0b-4cd8-a77f-0e29e628cde9" class="codeSnippetContainerCode" dir="ltr">
            <div style="color:Black;"><pre>UtilityClass.MethodA();
</pre></div>
            
        </div>
    </div>
</div>
<p><span id="xn5_4958798c5202db7a865c5622fd121878" class="sentence">Uma classe estática pode ser usada como um recipiente conveniente para conjuntos de métodos que só operam nos parâmetros de entrada e não precisará obter ou definir quaisquer campos de instância interno.</span>  <span id="xn6_d0b440a923f815540975205392a6d66d" class="sentence">Por exemplo, o.NET Framework Class Library estática <span xmlns="http://www.w3.org/1999/xhtml"><a href="http://msdn.microsoft.com/pt-br/library/system.math.aspx">System<span xmlns="">.</span>Math</a></span> classe contém métodos que executam operações matemáticas, sem a necessidade de armazenar ou recuperar dados que é exclusivos para uma determinada instância da <span xmlns="http://www.w3.org/1999/xhtml"><a href="http://msdn.microsoft.com/pt-br/library/system.math.aspx">Math</a></span> classe.</span>  <span id="xn7_d20d28f59e4c105e5b02ce101425dec8" class="sentence">Ou seja, aplicar os membros da classe, especificando o nome da classe e o nome do método, conforme mostrado no exemplo a seguir.</span>  </p>

<div class="codeSnippetContainer" xmlns="http://www.w3.org/1999/xhtml">
  <script type="text/javascript" src="./Static Classes and Static Class Members_files/CodeSnippet.js"></script>
  <link href="./Static Classes and Static Class Members_files/CodeSnippet.css" rel="stylesheet" type="text/css">
    <div class="codeSnippetContainerTabs">
        
    </div>
    <div class="codeSnippetContainerCodeContainer">
        <div class="codeSnippetToolBar">
            <div class="codeSnippetToolBarText">
                <a name="CodeSnippetCopyLink" title="Copiar para a área de transferência." href="javascript:CodeSnippet_CopyCode('CodeSnippetContainerCode_e39c3aa2-f29c-423e-ab5f-4457f4f801e1');">Copiar</a>
            </div>
        </div>
        <div id="CodeSnippetContainerCode_e39c3aa2-f29c-423e-ab5f-4457f4f801e1" class="codeSnippetContainerCode" dir="ltr">
            <div style="color:Black;"><pre>double dub = -3.14;
Console.WriteLine(Math.Abs(dub));
Console.WriteLine(Math.Floor(dub));
Console.WriteLine(Math.Round(Math.Abs(dub)));

// Output:
// 3.14
// -4
// 3


</pre></div>
            
        </div>
    </div>
</div>
<p><span id="xn8_35966f7eb613a71fc00f98d0f15b05b9" class="sentence">Tal como acontece com todos os tipos de classe, as informações do tipo para uma classe estática são carregadas pelo .NET Framework common language runtime (CLR) quando o programa que referencia a classe é carregado. O programa não pode especificar exatamente quando a classe é carregada.</span>  <span id="xn9_0be64aa459d29e2cc4721a2fec2a9815" class="sentence">No entanto, ele é garantido para ser carregado e ter seus campos inicializados e seu construtor estático chamado antes que a classe é referenciada pela primeira vez no seu programa.</span>  <span id="xn10_f73f40ff2ead506002cc78e367ed2860" class="sentence">Um construtor estático é chamado somente uma vez e uma classe estática permanece na memória durante a vida útil do domínio do aplicativo no qual reside o seu programa.</span>  </p><div class="alert"><table><tbody><tr><th><!--src=[../icons/alert_note.gif]--><img id="alert_note" alt="Observação" src="./Static Classes and Static Class Members_files/IC101471.gif" title="Observação" xmlns=""><strong>Observação</strong></th></tr><tr><td><p><span id="xn11_7365cdb959c3f62ef8dd9b7e9d8e840f" class="sentence">Para criar uma classe non-static que permite apenas uma instância de si mesmo para ser criado, consulte <a href="http://go.microsoft.com/fwlink/?LinkID=100567">Implementação Singleton em C#</a>.</span></p></td></tr></tbody></table></div><p><span id="xn12_c7d704c70f8ab719bdd9d424a06808e4" class="sentence">A lista a seguir fornece os principais recursos de um Estático classe:</span></p><ul><li><p><span id="xn13_f5557b52d4c02895f6dfa2987833f5ef" class="sentence">Contém apenas membros estáticos.</span></p></li><li><p><span id="xn14_591d7c29f18d2aa9c873bfa13910b0e2" class="sentence">Não é possível criar uma instância.</span></p></li><li><p><span id="xn15_3384595c698559a3faec2d6f92a841d7" class="sentence">É sealed.</span></p></li><li><p><span id="xn16_9e52c83cf8e6d728116dc3a02d233a1f" class="sentence">Não pode conter <a href="http://msdn.microsoft.com/pt-br/library/k6sa6h87.aspx">Construtores de instância</a>.</span></p></li></ul><p><span id="xn17_ded713cf49cd31aeb53110fd44a6f283" class="sentence">Criar uma classe estática é, portanto, basicamente o mesmo que criar uma classe que contém apenas membros estáticos e um construtor particular.</span>  <span id="xn18_2e6a6b5ce20e53abaacee1b1fc16c89e" class="sentence">Um construtor particular impede que a classe seja instanciado.</span>  <span id="xn19_658372daf7da0a6949d0351c1a7d6b5c" class="sentence">A vantagem de usar uma classe estática é que o compilador pode verificar para certificar-se de que não há membros de instância acidentalmente são adicionados.</span>  <span id="xn20_ed9f5d7e3a2f9424b5f3f8cd3f2da944" class="sentence">O compilador garante que as instâncias dessa classe não podem ser criadas.</span>  </p><p><span id="xn21_ef821c597072c4b0b39c640e94eb2470" class="sentence">Classes estáticas são seladas e portanto não podem ser herdadas.</span>  <span id="xn22_bc3a47b5a575909266f1332430455913" class="sentence">Eles não podem herdar de qualquer classe, exceto <span xmlns="http://www.w3.org/1999/xhtml"><a href="http://msdn.microsoft.com/pt-br/library/system.object.aspx">Object</a></span>.</span>  <span id="xn23_329279160c0c824064661347845df694" class="sentence">Classes estáticas não podem conter um construtor de instância; No entanto, eles podem conter um construtor estático.</span>  <span id="xn24_d37bd6a51d755b3273f72965880825fd" class="sentence">Classes de não-estático também devem definir um construtor estático se a classe contém membros estáticos que requerem inicialização não trivial.</span>  <span id="xn25_4ce841d1861f2f0635c7011d5b6c7277" class="sentence">Para obter mais informações, consulte <span xmlns="http://www.w3.org/1999/xhtml"><a href="http://msdn.microsoft.com/pt-br/library/k9x6w0hc.aspx">Construtores estáticos (guia de programação de C#)</a></span>.</span>  </p></div><div xmlns=""><script type="text/javascript">if (!MTPS) var MTPS = {};if (!MTPS.LocalizedStrings) MTPS.LocalizedStrings = {}; 
              MTPS.LocalizedStrings.ExpandButtonTooltip = 'Expandir'; 
              MTPS.LocalizedStrings.CollapseButtonTooltip = 'Recolher';</script><div class="LW_CollapsibleArea_TitleDiv"><div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Recolher"><img src="./Static Classes and Static Class Members_files/clear.gif" class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"><span class="LW_CollapsibleArea_Title">Exemplo</span></a><div class="LW_CollapsibleArea_HrDiv"><hr class="LW_CollapsibleArea_Hr"></div></div></div><div class="sectionblock"><a id="exampleToggle" xmlns="http://www.w3.org/1999/xhtml">
  <!---->
</a>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn26_ae06f2fbe286f606a2984355a4010cab" class="sentence">Aqui está um exemplo de uma classe estática que contém dois métodos converter Temperatura Celsius para Fahrenheit e de Fahrenheit para Celsius:</span>
</p>
<div id="snippetGroup" xmlns="http://www.w3.org/1999/xhtml">

<div class="codeSnippetContainer" xmlns="http://www.w3.org/1999/xhtml">
  <script type="text/javascript" src="./Static Classes and Static Class Members_files/CodeSnippet.js"></script>
  <link href="./Static Classes and Static Class Members_files/CodeSnippet.css" rel="stylesheet" type="text/css">
    <div class="codeSnippetContainerTabs">
        <div class="codeSnippetContainerTab codeSnippetContainerTabSingle" dir="ltr"><a>C#</a></div>
    </div>
    <div class="codeSnippetContainerCodeContainer">
        <div class="codeSnippetToolBar">
            <div class="codeSnippetToolBarText">
                <a name="CodeSnippetCopyLink" title="Copiar para a área de transferência." href="javascript:CodeSnippet_CopyCode('CodeSnippetContainerCode_92bd7e61-2d01-4d99-ae0b-691b687ef15d');">Copiar</a>
            </div>
        </div>
        <div id="CodeSnippetContainerCode_92bd7e61-2d01-4d99-ae0b-691b687ef15d" class="codeSnippetContainerCode" dir="ltr">
            <div style="color:Black;"><pre>
    <span style="color:Blue;">public</span> <span style="color:Blue;">static</span> <span style="color:Blue;">class</span> TemperatureConverter
    {
        <span style="color:Blue;">public</span> <span style="color:Blue;">static</span> <span style="color:Blue;">double</span> CelsiusToFahrenheit(<span style="color:Blue;">string</span> temperatureCelsius)
        {
            <span style="color:Green;">// Convert argument to double for calculations.</span>
            <span style="color:Blue;">double</span> celsius = Double.Parse(temperatureCelsius);

            <span style="color:Green;">// Convert Celsius to Fahrenheit.</span>
            <span style="color:Blue;">double</span> fahrenheit = (celsius * 9 / 5) + 32;

            <span style="color:Blue;">return</span> fahrenheit;
        }

        <span style="color:Blue;">public</span> <span style="color:Blue;">static</span> <span style="color:Blue;">double</span> FahrenheitToCelsius(<span style="color:Blue;">string</span> temperatureFahrenheit)
        {
            <span style="color:Green;">// Convert argument to double for calculations.</span>
            <span style="color:Blue;">double</span> fahrenheit = Double.Parse(temperatureFahrenheit);

            <span style="color:Green;">// Convert Fahrenheit to Celsius.</span>
            <span style="color:Blue;">double</span> celsius = (fahrenheit - 32) * 5 / 9;

            <span style="color:Blue;">return</span> celsius;
        }
    }

    <span style="color:Blue;">class</span> TestTemperatureConverter
    {
        <span style="color:Blue;">static</span> <span style="color:Blue;">void</span> Main()
        {
            Console.WriteLine(<span style="color:#A31515;">"Please select the convertor direction"</span>);
            Console.WriteLine(<span style="color:#A31515;">"1. From Celsius to Fahrenheit."</span>);
            Console.WriteLine(<span style="color:#A31515;">"2. From Fahrenheit to Celsius."</span>);
            Console.Write(<span style="color:#A31515;">":"</span>);

            <span style="color:Blue;">string</span> selection = Console.ReadLine();
            <span style="color:Blue;">double</span> F, C = 0;

            <span style="color:Blue;">switch</span> (selection)
            {
                <span style="color:Blue;">case</span> <span style="color:#A31515;">"1"</span>:
                    Console.Write(<span style="color:#A31515;">"Please enter the Celsius temperature: "</span>);
                    F = TemperatureConverter.CelsiusToFahrenheit(Console.ReadLine());
                    Console.WriteLine(<span style="color:#A31515;">"Temperature in Fahrenheit: {0:F2}"</span>, F);
                    <span style="color:Blue;">break</span>;

                <span style="color:Blue;">case</span> <span style="color:#A31515;">"2"</span>:
                    Console.Write(<span style="color:#A31515;">"Please enter the Fahrenheit temperature: "</span>);
                    C = TemperatureConverter.FahrenheitToCelsius(Console.ReadLine());
                    Console.WriteLine(<span style="color:#A31515;">"Temperature in Celsius: {0:F2}"</span>, C);
                    <span style="color:Blue;">break</span>;

                <span style="color:Blue;">default</span>:
                    Console.WriteLine(<span style="color:#A31515;">"Please select a convertor."</span>);
                    <span style="color:Blue;">break</span>;
            }

            <span style="color:Green;">// Keep the console window open in debug mode.</span>
            Console.WriteLine(<span style="color:#A31515;">"Press any key to exit."</span>);
            Console.ReadKey();
        }
    }
    <span style="color:Green;">/* Example Output:
        Please select the convertor direction
        1. From Celsius to Fahrenheit.
        2. From Fahrenheit to Celsius.
        :2
        Please enter the Fahrenheit temperature: 20
        Temperature in Celsius: -6.67
        Press any key to exit.
     */</span>



</pre></div>
            
        </div>
    </div>
</div>
</div></div></div><div xmlns=""><div class="LW_CollapsibleArea_TitleDiv"><div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Recolher"><img src="./Static Classes and Static Class Members_files/clear.gif" class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"><span class="LW_CollapsibleArea_Title">Membros estáticos</span></a><div class="LW_CollapsibleArea_HrDiv"><hr class="LW_CollapsibleArea_Hr"></div></div></div><div class="sectionblock"><a id="sectionToggle0" xmlns="http://www.w3.org/1999/xhtml">
  <!---->
</a>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn27_bf545d68a2023f59db6f4eff4040d95d" class="sentence">Uma classe non-static pode conter métodos estáticos, campos, propriedades ou eventos.</span>  <span id="xn28_6ca94499cab9731e379b8167ffe0da57" class="sentence">O membro estático é que pode ser chamado em uma classe, mesmo quando nenhuma instância da classe foi criada.</span>  <span id="xn29_e2c67e8b86c9d97a09d01282300598eb" class="sentence">O membro estático sempre é acessado pelo nome da classe, não o nome da instância.</span>  <span id="xn30_b32542010887c70e038f3c33209a1b3c" class="sentence">Apenas uma copia de um membro estático existe, independentemente de quantas instâncias da classe são criadas.</span>  <span id="xn31_c88b6fea5e8bd742d0b4e767a04c1653" class="sentence">Não é possível acessar propriedades e métodos estáticos não-static campos e eventos em seu tipo de recipiente e eles não podem acessar uma variável de instância de qualquer objeto, a menos que explicitamente, ele é passado um parâmetro de método.</span>  </p>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn32_b944d7559ae20b6511e17859a29c97f3" class="sentence">É mais comum para declarar uma classe non-static com alguns membros estáticos, que para declarar uma classe inteira como estático.</span>  <span id="xn33_42e732f1c0931674077a826cf5b063c7" class="sentence">Dois usos comum de campos estáticos são para manter&nbsp;uma conta do número de objetos que foi criada, ou para armazenar valor comum que deve ser compartilhado entre todas as instâncias.</span>  </p>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn34_00904cd0374edb019e54775f70bb03bc" class="sentence">Métodos estáticos podem ser sobrecarregados, mas não substituídos, porque eles pertencem à classe e não para qualquer instância da classe.</span>
</p>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn35_13d1fc30a917e780de11d009a1a8d301" class="sentence">Embora um campo não pode ser declarado como <span class="code" xmlns="http://www.w3.org/1999/xhtml">static const</span>, um <a href="http://msdn.microsoft.com/pt-br/library/e6w8fe1b.aspx">const</a> campo é essencialmente estático em seu comportamento.</span>  <span id="xn36_7de1c6fde0be835431b7219f9fe329d9" class="sentence">Ele pertence ao tipo, não para instâncias do tipo.</span>  <span id="xn37_5d2d8b09998ad10bdc521fe964759fe0" class="sentence">Portanto, os campos de const podem ser acessados usando o mesmo <span class="code" xmlns="http://www.w3.org/1999/xhtml">ClassName.MemberName</span> notação que é usada para campos estáticos.</span>  <span id="xn38_86ec0a09339125c082f6557654c9444f" class="sentence">Nenhuma instância do objeto é necessária.</span>  </p>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn39_6339f812c852c91ef35c1b96f39ec2c7" class="sentence">C# não oferece suporte a variáveis locais estáticas (variáveis são declaradas no escopo do método). </span>
</p>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn40_b285be4ab2a1287c58b2c2f463fe6809" class="sentence">Você declara os membros da classe estática usando o <span xmlns="http://www.w3.org/1999/xhtml"><span class="input">static</span></span> palavra-chave antes do tipo de retorno do membro, conforme mostrado no exemplo a seguir:</span>
</p>
<div id="snippetGroup1" xmlns="http://www.w3.org/1999/xhtml">

<div class="codeSnippetContainer" xmlns="http://www.w3.org/1999/xhtml">
  <script type="text/javascript" src="./Static Classes and Static Class Members_files/CodeSnippet.js"></script>
  <link href="./Static Classes and Static Class Members_files/CodeSnippet.css" rel="stylesheet" type="text/css">
    <div class="codeSnippetContainerTabs">
        <div class="codeSnippetContainerTab codeSnippetContainerTabSingle" dir="ltr"><a>C#</a></div>
    </div>
    <div class="codeSnippetContainerCodeContainer">
        <div class="codeSnippetToolBar">
            <div class="codeSnippetToolBarText">
                <a name="CodeSnippetCopyLink" title="Copiar para a área de transferência." href="javascript:CodeSnippet_CopyCode('CodeSnippetContainerCode_f1843e0b-06c1-4dbf-90ad-ec7b40400650');">Copiar</a>
            </div>
        </div>
        <div id="CodeSnippetContainerCode_f1843e0b-06c1-4dbf-90ad-ec7b40400650" class="codeSnippetContainerCode" dir="ltr">
            <div style="color:Black;"><pre>
<span style="color:Blue;">public</span> <span style="color:Blue;">class</span> Automobile
{
    <span style="color:Blue;">public</span> <span style="color:Blue;">static</span> <span style="color:Blue;">int</span> NumberOfWheels = 4;
    <span style="color:Blue;">public</span> <span style="color:Blue;">static</span> <span style="color:Blue;">int</span> SizeOfGasTank
    {
        <span style="color:Blue;">get</span>
        {
            <span style="color:Blue;">return</span> 15;
        }
    }
    <span style="color:Blue;">public</span> <span style="color:Blue;">static</span> <span style="color:Blue;">void</span> Drive() { }
    <span style="color:Blue;">public</span> <span style="color:Blue;">static</span> <span style="color:Blue;">event</span> EventType RunOutOfGas;

    <span style="color:Green;">// Other non-static fields and properties...</span>
}


</pre></div>
            
        </div>
    </div>
</div>
</div>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn41_4bf9c9bee5c7d79055afdce88c48df77" class="sentence">Membros estáticos são inicializados antes do membro estático é acessado pela primeira vez e antes do construtor estático, se houver, é chamado.</span>  <span id="xn42_60c92ba9d84dbc133d96d77e492908b3" class="sentence">Para acessar um membro de classe estática, use o nome da classe em vez de um nome de variável para especificar o local do membro, conforme mostrado no exemplo a seguir:</span>  </p>
<div id="snippetGroup2" xmlns="http://www.w3.org/1999/xhtml">

<div class="codeSnippetContainer" xmlns="http://www.w3.org/1999/xhtml">
  <script type="text/javascript" src="./Static Classes and Static Class Members_files/CodeSnippet.js"></script>
  <link href="./Static Classes and Static Class Members_files/CodeSnippet.css" rel="stylesheet" type="text/css">
    <div class="codeSnippetContainerTabs">
        <div class="codeSnippetContainerTab codeSnippetContainerTabSingle" dir="ltr"><a>C#</a></div>
    </div>
    <div class="codeSnippetContainerCodeContainer">
        <div class="codeSnippetToolBar">
            <div class="codeSnippetToolBarText">
                <a name="CodeSnippetCopyLink" title="Copiar para a área de transferência." href="javascript:CodeSnippet_CopyCode('CodeSnippetContainerCode_1070d362-e2d6-4d6d-9ddb-9ed93a17eb03');">Copiar</a>
            </div>
        </div>
        <div id="CodeSnippetContainerCode_1070d362-e2d6-4d6d-9ddb-9ed93a17eb03" class="codeSnippetContainerCode" dir="ltr">
            <div style="color:Black;"><pre>
Automobile.Drive();
<span style="color:Blue;">int</span> i = Automobile.NumberOfWheels;


</pre></div>
            
        </div>
    </div>
</div>
</div>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn43_9b645085a92712de2e993872f02e5f5d" class="sentence">Se sua classe contém campos estáticos, fornece um construtor estático que inicializa-los quando a classe é carregada.</span>
</p>
<p xmlns="http://www.w3.org/1999/xhtml">
  <span id="xn44_d4c3602887a6ef1c70fd2718b79d4a61" class="sentence">Uma chamada para um método estático gera uma instrução de chamada na Microsoft intermediate language (MSIL), enquanto uma chamada para um método de instância gera um <span xmlns="http://www.w3.org/1999/xhtml"><span class="input">callvirt</span></span> as instruções, que também procura referências um objeto nulo.</span>  <span id="xn45_87ae23ce5c5330da9cc9809fb463f577" class="sentence">No entanto, na maioria das vezes a diferença de desempenho entre os dois não é significativa.</span>  </p></div></div><div xmlns=""><div class="LW_CollapsibleArea_TitleDiv"><div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Recolher"><img src="./Static Classes and Static Class Members_files/clear.gif" class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"><span class="LW_CollapsibleArea_Title">Especificação da linguagem C#</span></a><div class="LW_CollapsibleArea_HrDiv"><hr class="LW_CollapsibleArea_Hr"></div></div></div><div class="sectionblock"><a id="sectionToggle1" xmlns="http://www.w3.org/1999/xhtml">
  <!---->
</a>
<p xmlns="http://www.w3.org/1999/xhtml">
    </p>
<p xmlns="http://www.w3.org/1999/xhtml">Para obter mais informações, consulte <span><a href="http://msdn.microsoft.com/pt-br/library/ms228593.aspx">C# Language Specification</a></span> A especificação de linguagem é a fonte definitiva para a sintaxe e o uso de C#.</p>
  </div></div><div xmlns=""><div class="LW_CollapsibleArea_TitleDiv"><div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Recolher"><img src="./Static Classes and Static Class Members_files/clear.gif" class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"><span class="LW_CollapsibleArea_Title">Consulte também</span></a><div class="LW_CollapsibleArea_HrDiv"><hr class="LW_CollapsibleArea_Hr"></div></div></div><div class="sectionblock"><a id="seeAlsoToggle" xmlns="http://www.w3.org/1999/xhtml">
  <!---->
</a>
<h4 class="subHeading" xmlns="http://www.w3.org/1999/xhtml">Referência</h4>
<div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
  <span>
    <a href="http://msdn.microsoft.com/pt-br/library/98f28cdx.aspx">static (C# Reference)</a>
  </span>
</div>
<div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
  <span>
    <a href="http://msdn.microsoft.com/pt-br/library/x9afc042.aspx">Classes (C# Programming Guide)</a>
  </span>
</div>
<div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
  <span>
    <a href="http://msdn.microsoft.com/pt-br/library/0b0thckt.aspx">classe (Referência de C#)</a>
  </span>
</div>
<div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
  <span>
    <a href="http://msdn.microsoft.com/pt-br/library/k9x6w0hc.aspx">Construtores estáticos (guia de programação de C#)</a>
  </span>
</div>
<div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
  <span>
    <a href="http://msdn.microsoft.com/pt-br/library/k6sa6h87.aspx">Instance Constructors (C# Programming Guide)</a>
  </span>
</div>
<h4 class="subHeading" xmlns="http://www.w3.org/1999/xhtml">Conceitos</h4>
<div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
  <span>
    <a href="http://msdn.microsoft.com/pt-br/library/67ef8sbd.aspx">C# Programming Guide</a>
  </span>
</div>
<div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
  <span>
    <a href="http://msdn.microsoft.com/pt-br/library/ms229038.aspx">Design de classe estática</a>
  </span>
</div></div></div></div>
  </div>
</div>
    </div>
    
    <div class="topicEndLine">
    </div>
    <div id="CommunityContent" class="CommunityContent">
      
<div class="CommunityContentContainer">
    <div id="CommunityContentHeader" class="CommunityContentHeader">
      <div class="CommunityContentHeaderTitleContainer">
        <span class="CommunityContentHeaderTitle h1">Conteúdo da Comunidade</span>
          
        <a href="http://msdn.microsoft.com/pt-br/library/community/add/79b3xss3.aspx" title="Add" rel="nofollow">Adicionar</a>
          
        </div>
        <div class="CommunityContentFaq">
            <a href="http://msdn.microsoft.com/pt-br/library/community-edits.rss?topic=79b3xss3|pt-br|VS.100" title="Anotações" rel="nofollow"><img class="cl_rss_button" alt="Anotações" src="./Static Classes and Static Class Members_files/clear.gif"></a>
            <a href="http://msdn.microsoft.com/pt-br/library/community-msdnwikifaq.aspx" title="FAQ" rel="nofollow">Perguntas frequentes</a>
        </div>
        <div style="clear:both"></div>
    </div>
    
    

</div>
    </div>
    


<script type="text/javascript">
//<![CDATA[
if (!MTPS) {
    MTPS = {};
}
MTPS.NetReflectorInit = {
        surveyUrl: "http://vp-nri.com/take?i=164843&h=RdbfWtVdK5pN9PWbnA3OSA",
        privacyStatementText: "Politica de Privacidade",
        trackerWindowText: "Não feche esta janela.<br><br>Obrigado! A pesquisa será exibida aqui quando você terminar sua visita. Por isso, pedimos que você não feche esta janela.",
        privacyStatementLink: "http://msdn.microsoft.com/pt-br/gg723766.aspx",
        trackerHeaderClass: "msdn_TrackerHeader"
};

//]]>
</script>
<script src="./Static Classes and Static Class Members_files/NetReflector.js" type="text/javascript"></script>
<link rel="stylesheet" href="./Static Classes and Static Class Members_files/NetReflector.css" type="text/css"> 
<div class="NetReflectorMain SkipMeIAmAlradyAbsolutePushed" style="top: 226px !important; display: none; left: 488px; ">
  <div class="msdn_NRHeader"></div>
  <a class="NRCloseButton clip22x30" href="javascript:void(0)" style="display:inline-block">
    <img alt="" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_msdn_close">
  </a>
  <div class="NRTopStripe"></div>
  <div class="NRNotification">
    <div>A Microsoft está realizando uma pesquisa online para saber sua opinião sobre o site do MSDN. Se você optar por participar, a pesquisa online lhe será apresentada quando você sair do site do MSDN.<br><br>Deseja participar?
    </div>
    <input class="NRSubmit" type="button" value="Sim">
    <input class="NRCancel" type="button" value="Não">
    <div class="PrivacyStatement"><a href="http://msdn.microsoft.com/pt-br/gg723766.aspx" target="_blank">Politica de Privacidade</a></div>
  </div>
  <div class="NRBottomStripe"></div>
</div>

  </div>
        
  </div>
  <div class="footer">
    
<link href="./Static Classes and Static Class Members_files/Footer.css" rel="stylesheet" type="text/css">
<div id="footer" class="footerContainer cl_footer_slice">
  <div class="footerLogoContainer">
    <div class="footerContent">
    <div class="copyright">
      © 2012 Microsoft. Todos os direitos reservados.</div>
    <div class="footerLogo cl_footer_logo"></div>
    <a href="http://msdn.microsoft.com/pt-br/cc300389.aspx">Termos de Uso</a><span class="pipe"> | </span>
    <a href="http://www.microsoft.com/library/toolbar/3.0/trademarks/pt-br.mspx">Marcas Comerciais</a><span class="pipe"> | </span>
    <a href="http://privacy.microsoft.com/pt-br/default.mspx">Politica de Privacidade</a>
    <span class="pipe">| </span>
    <span class="FeedbacklinkDisabled" id="FeedbacklinkDisabled">Comentários</span>
    <a id="Feedbacklink" title="Comentários" class="FeedbackLink" href="javascript:void(0)">
      Comentários
        <span class="FeedbackButton clip20x21" id="FeedbackButton">
          <img id="feedBackImg" class="cl_footer_feedback_icon" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" alt="Comentários">
        </span>
      </a>
    
  <div id="FeedbackContainer" class="FeedbackContainer">
    <form method="post" action="http://msdn.microsoft.com/pt-br/library/feedback/add/79b3xss3.aspx">
    <div class="FeedbackTitleContainer">
        <div class="FeedbackTitle">
            Comentários</div>
        <div class="FeedbackCancel">
            <a href="javascript:;" onclick="document.getElementById(&#39;FeedbackContainer&#39;).style.display = &#39;none&#39;;">x</a>
            </div>
    </div>
    <div class="FeedbackData">
        <div class="FeedbackInfoText">
            Informe-nos sobre a sua experiência...
        </div>
        <div class="QuestionText">
            A página carregou rápido?
        </div>
        <div class="AnswerText">
            
            <span>
                Sim<span>
                    <input id="searchBox" name="searchBox" type="radio" value="1"></span></span>
            
            <span>
                Não<span>
                    <input id="searchBox" name="searchBox" type="radio" value="0"></span></span>
            
        </div>
        <div class="QuestionText">
            Você gosta do design da página?
        </div>
        <div class="AnswerText">
            
            <span>
                Sim<span>
                    <input id="tabbedCode" name="tabbedCode" type="radio" value="1"></span></span>
            
            <span>
                Não<span>
                    <input id="tabbedCode" name="tabbedCode" type="radio" value="0"></span></span>
            
        </div>
        <div class="QuestionText">
            Este tópico foi útil?
        </div>
        <div class="FeedbackGraphicHolder clip269x23">            
                <img alt="" src="./Static Classes and Static Class Members_files/Msdn_ImageSprite.png" class="cl_online_scale FeedbackSiderGraphic">
        </div>        
            <div class="RadioButtonHolder"><div class="RateRadioOne">
                    <input id="topicUseful" name="topicUseful" title="Não gostei nem um pouco" type="radio" value="1">
                </div>
               <div class="RateRadio">
                    <input id="topicUseful" name="topicUseful" title="Não gostei" type="radio" value="2">
                </div>
               <div class="RateRadio">
                    <input id="topicUseful" name="topicUseful" title="OK" type="radio" value="3">
                </div>
               <div class="RateRadio">
                    <input id="topicUseful" name="topicUseful" title="Bom" type="radio" value="4">
                </div>
               <div class="RateRadioLast">
                    <input id="topicUseful" name="topicUseful" title="Muito bom" type="radio" value="5">
                </div>
               
            </div>            
        <div class="QuestionText">
            Fale mais
        </div>
        <div class="FeedbackTextAreaContainer">
            <textarea id="feedbackText" data-maxlength="4000" name="feedbackText" cols="25" rows="5" class="FeedbackTextArea"></textarea>
            
            <textarea id="feedbackDescription" name="feedbackDescription" cols="25" rows="10" style="display:none;">Enter description here.</textarea>
            <input type="hidden" id="feedbackPriority" name="feedbackPriority" value="">
            <input type="hidden" id="feedbackSourceUrl" name="feedbackSourceUrl" value="">
            <input type="hidden" id="ClientIP" name="ClientIP" value="">
            <input type="hidden" id="ClientOS" name="ClientOS" value="">
            <input type="hidden" id="ClientBrowser" name="ClientBrowser" value="">
            <input type="hidden" id="ClientTime" name="ClientTime" value="">
            <input type="hidden" id="ClientTimeZone" name="ClientTimeZone" value="">
            
            
        </div>
        <div>
            <input type="submit" value="Enviar" class="FeedbackSubmit" onclick="document.getElementById(&#39;feedbackDescription&#39;).value=&#39;&#39;;document.getElementById(&#39;feedBackVersion&#39;).value = &#39;-1&#39;;">
        </div>
    </div>
    <input type="hidden" id="returnUrl" name="returnUrl" value="http://msdn.microsoft.com/pt-br/library/79b3xss3.aspx">
    
    
    <input type="hidden" id="feedBackVersion" name="feedBackVersion" value="1">
    
  </form> 
</div>

    </div>
  </div>
</div>

  </div>
 


<div id="popup-loading0" class="popup-loading" style="display: none; z-index: 97; width: auto; height: auto; left: 294px; top: 165px; ">loading...</div><div id="popup0" class="MTPopup" style="z-index: 97; width: auto; height: auto; max-width: 1015px; left: 294px; top: 165px; display: none; "><div class="popup-main" style="z-index: 97; "><div class="popup-inner">For example, if you have a static class that is named <span class="code">UtilityClass</span> that has a public method named <span class="code">MethodA</span>, you call the method as shown in the following example:</div></div></div><div class="SkipThisFixedPosition top-iframe-wrapper" style="width: 100%; height: 34px; position: fixed; top: 0px !important; left: 0px; z-index: 99997; "><iframe style="width:100%;height:34px;top:0px;left:0px;" src="./Static Classes and Static Class Members_files/container.htm" scrolling="no" class="toolbarContainer" frameborder="0px" id="CWTBiframe0"></iframe></div><div id="mainContainer_CTID"><div class="fixedDiv SkipThisFixedPosition UrlGadgetsDiv" style="position: fixed; left: 0px; top: 34px !important; z-index: 2147483640; "></div><div class="fixedDiv SkipThisFixedPosition GeneralGadgetsDiv" style="position: fixed; left: 0px; top: 34px !important; z-index: 2147483640; width: 100%; "></div></div><script src="./Static Classes and Static Class Members_files/broker-config.js"></script><div style="display: none; " id="_WEDCSInsertedData"><iframe id="_msnFrame" src="./Static Classes and Static Class Members_files/Sync.htm" style="z-index:-1;height:1px;width:1px;display:none;visibility:hidden;" onload="javascript:MscomBeacon();"></iframe></div></body><style type="text/css" id="CWToolbarStyle">html { padding-top: 34px !important;}</style></html>